home *** CD-ROM | disk | FTP | other *** search
Wrap
Text File | 2009-10-29 | 40.7 KB | 1,363 lines
executeScript("scripts\\sounds.lua") -- target - unit on which to find free spot -- firespottype - int == 1 or 2 - type of firespot - for first weapon or second -- checkForEffectType == int - firespot considered free if it haven't effect of that type function units_findfreefirespot(unit,weaponnumber) local firespottype = ENBT_FIRE1 if(weaponnumber == 2) then firespottype = ENBT_FIRE2 end local i = 0 local place while true do place = unit:getBone(firespottype,i); if(place == nil or place:getFreeCargoSpace() >= 1) then return place end i = i + 1 end end -- reloads free firespots of weaponType -- free considered as absense of weaponEffectType effects function units_reloadfirespots(unit,weaponnumber,weaponEffectType) local firespottype = ENBT_FIRE1 if(weaponnumber == 2) then firespottype = ENBT_FIRE2 end local firespot; local i = 0 while true do firespot = unit:getBone(firespottype,i) if(firespot == nil) then return end if(firespot:getFreeCargoSpace() >= 1) then firespot:addSimpleEffect(weaponEffectType) end i = i + 1 end end function units_explode(partsDist,explodeType,isShakeCamera) local unit = uniGetExecutor() -- unit:setLifeParams(1,0) unit:setTransformOwner() unit:play3DSound("bigunitexplode.wav",0):destroy() -- stop burning effects local fire fire = unit:findEffect(ENET_EFFECT_PS_SMALLUNITFIRING) if(fire ~= nil) then fire:suspendedDestroy(1.0) end fire = unit:findEffect(ENET_EFFECT_PS_UNITFIRINGBADLY) if(fire ~= nil) then fire:suspendedDestroy(1.0) end local exp_ps = unit:addSimpleEffect(explodeType) exp_ps:suspendedDestroy(3.0) exp_ps:setTransformOwner() pause(0.1) unit:explode(partsDist) local ht = getHeightType(unit:getWorldPosition()); if(isShakeCamera == true and ht ~= ENBHT_WATERHIT) then getCamera():shake(1.0,6.0) end -- explosion mark pause(0.25) if(ht ~= ENBHT_WATERHIT) then local exp_mark = unit:addSimpleEffect(ENET_EFFECT_DYNAMICGEOMETRY_EXPLOSIONMARK_BIG) exp_mark:delayedDestroy(70.0) exp_mark:setTransformOwner() -- local upos = unit:getWorldPosition() -- getCamera():setLocalPosition(upos.x,upos.y,upos.z - 200) end local wv = unit:findEffect(ENET_EFFECTSEMITTER_SHIPSTANDINGWATERWAVE) if(wv ~= nil) then wv:suspendedDestroy(4) end unit:removeSpaceHoldingEffects(); units_stopFansRadars() end function units_explode_detailed(partsDist,explodeType,isShakeCamera,isRing,lightType) local unit = uniGetExecutor() -- unit:setLifeParams(1,0) unit:setTransformOwner() unit:play3DSound("bigunitexplode.wav",0):destroy() -- stop burning effects local fire fire = unit:findEffect(ENET_EFFECT_PS_SMALLUNITFIRING) if(fire ~= nil) then fire:suspendedDestroy(1.0) end fire = unit:findEffect(ENET_EFFECT_PS_UNITFIRINGBADLY) if(fire ~= nil) then fire:suspendedDestroy(1.0) end local exp_ps = unit:addSimpleEffect(explodeType) local exp_ps_light = unit:addSimpleEffect(lightType) if(isRing == true) then --local exp_ps2 = unit:addSimpleEffect(ENET_EFFECT_SP_ENVIRONMENT_EXPLOSION_RING4) --exp_ps2:suspendedDestroy(0.8) -- pause(0.4) local exp_ps2_2 = unit:addSimpleEffect(ENET_EFFECT_SP_ENVIRONMENT_EXPLOSION_RING) exp_ps2_2:suspendedDestroy(0.8) end exp_ps:suspendedDestroy(5.0) exp_ps:setTransformOwner() exp_ps_light:suspendedDestroy(3.0) pause(0.1) unit:explode(partsDist) local ht = getHeightType(unit:getWorldPosition()); --if(isShakeCamera == true and ht ~= ENBHT_WATERHIT) then getCamera():shake(1.0,6.0) end -- explosion mark pause(0.25) if(ht ~= ENBHT_WATERHIT) then local exp_mark = unit:addSimpleEffect(ENET_EFFECT_DYNAMICGEOMETRY_EXPLOSIONMARK_BIG) exp_mark:delayedDestroy(70.0) exp_mark:setTransformOwner() -- local upos = unit:getWorldPosition() -- getCamera():setLocalPosition(upos.x,upos.y,upos.z - 200) end local wv = unit:findEffect(ENET_EFFECTSEMITTER_SHIPSTANDINGWATERWAVE) if(wv ~= nil) then wv:suspendedDestroy(4) end unit:removeSpaceHoldingEffects(); units_stopFansRadars() end function units_explode_detailed2(partsDist,explodeType,isShakeCamera,isRing,lightType) local unit = uniGetExecutor() unit:setTransformOwner() unit:play3DSound("bigunitexplode.wav",0):destroy() -- stop burning effects local fire fire = unit:findEffect(ENET_EFFECT_PS_SMALLUNITFIRING) if(fire ~= nil) then fire:suspendedDestroy(1.0) end fire = unit:findEffect(ENET_EFFECT_PS_UNITFIRINGBADLY) if(fire ~= nil) then fire:suspendedDestroy(1.0) end if(isRing == true) then local exp_ps2 = unit:addSimpleEffect(ENET_EFFECT_SP_ENVIRONMENT_EXPLOSION_RING) exp_ps2:suspendedDestroy(0.8) end local stroke_ps local exp_ps_s local pos = D3DXVECTOR3:new(0,0,0) local exp_ps for m = 0,26 do pos.x = rand(-50,50) pos.y = rand(10,80) pos.z = rand(-50,50) exp_ps_s = unit:addParticleSystem(ENET_EFFECT_PS_ROCKETEXPLODE,pos.x,pos.y,pos.z) stroke_ps = unit:addSimpleEffect(ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_BIG3_TRACE2) stroke_ps:setLocalPosition(pos.x,pos.y,pos.z) stroke_ps:parabolicFly(pos,rand(120,150)) pause(rand(0,0.15)) exp_ps_s:suspendedDestroy(2.0) stroke_ps:delayedDestroy(1.0) if(m == 21) then unit:explode(40) end if(m == 16) then exp_ps = unit:addParticleSystem(explodeType,0,10,0) end end pause(0.6) exp_ps:suspendedDestroy(10.0) local ht = getHeightType(unit:getWorldPosition()) -- explosion mark pause(0.25) if(ht ~= ENBHT_WATERHIT) then local exp_mark = unit:addSimpleEffect(ENET_EFFECT_DYNAMICGEOMETRY_EXPLOSIONMARK_BIG) exp_mark:delayedDestroy(70.0) exp_mark:setTransformOwner() end local wv = unit:findEffect(ENET_EFFECTSEMITTER_SHIPSTANDINGWATERWAVE) if(wv ~= nil) then wv:suspendedDestroy(4) end unit:removeSpaceHoldingEffects() units_stopFansRadars() pos:delete() end function units_explode_detailed3(partsDist,explodeType,isShakeCamera,isRing,lightType) local unit = uniGetExecutor() -- unit:setLifeParams(1,0) unit:setTransformOwner() unit:play3DSound("bigunitexplode.wav",0):destroy() -- stop burning effects local fire fire = unit:findEffect(ENET_EFFECT_PS_SMALLUNITFIRING) if(fire ~= nil) then fire:suspendedDestroy(1.0) end fire = unit:findEffect(ENET_EFFECT_PS_UNITFIRINGBADLY) if(fire ~= nil) then fire:suspendedDestroy(1.0) end if(isRing == true) then local exp_ps2 = unit:addSimpleEffect(ENET_EFFECT_SP_ENVIRONMENT_EXPLOSION_RING) exp_ps2:suspendedDestroy(0.8) end local pos = D3DXVECTOR3:new(0,0,0) local l = 0 for l = 0,0 do local stroke_ps2 = {} local exp_ps = unit:addSimpleEffect(explodeType) local j = 0 --if(j == 10) then unit:explode(partsDist) end unit:explode(partsDist) for j = 0,60 do pos.x = rand(-20,20) pos.y = rand(15,40) pos.z = rand(-20,20) stroke_ps2[j] = unit:addSimpleEffect(ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_BIG3_TRACE2) stroke_ps2[j]:setLocalPosition(pos.x,pos.y,pos.z) local gravity = createInterpolator() gravity:addKey(0.0,0.0) gravity:addKey(8.0,-250.0) gravity:finalize(false) local trajectory = stroke_ps2[j]:parabolicFly(pos,rand(30,80)) trajectory:addInterpolator(gravity,getFieldOffset(EN_FIELD_3DPARABOLICMOVER_GRAVITY)) --waitDeath(trajectory) end pause(0.7) local exp_ps_light = unit:addSimpleEffect(lightType) exp_ps:suspendedDestroy(10.0) exp_ps:setTransformOwner() exp_ps_light:suspendedDestroy(3.0) pause(2.3) for j = 0,60 do stroke_ps2[j]:suspendedDestroy(8.0) end end pause(0.6) local ht = getHeightType(unit:getWorldPosition()); --if(isShakeCamera == true and ht ~= ENBHT_WATERHIT) then getCamera():shake(1.0,6.0) end -- explosion mark pause(0.25) if(ht ~= ENBHT_WATERHIT) then local exp_mark = unit:addSimpleEffect(ENET_EFFECT_DYNAMICGEOMETRY_EXPLOSIONMARK_BIG) exp_mark:delayedDestroy(70.0) exp_mark:setTransformOwner() -- local upos = unit:getWorldPosition() -- getCamera():setLocalPosition(upos.x,upos.y,upos.z - 200) end local wv = unit:findEffect(ENET_EFFECTSEMITTER_SHIPSTANDINGWATERWAVE) if(wv ~= nil) then wv:suspendedDestroy(4) end unit:removeSpaceHoldingEffects(); units_stopFansRadars() pos:delete() end function units_explode_expert(partsDist,explodeType,isShakeCamera,isRing,lightType,NumOfRays,RayEffect) local unit = uniGetExecutor() -- unit:setLifeParams(1,0) unit:setTransformOwner() unit:play3DSound("bigunitexplode.wav",0):destroy() -- stop burning effects local fire fire = unit:findEffect(ENET_EFFECT_PS_SMALLUNITFIRING) if(fire ~= nil) then fire:suspendedDestroy(1.0) end fire = unit:findEffect(ENET_EFFECT_PS_UNITFIRINGBADLY) if(fire ~= nil) then fire:suspendedDestroy(1.0) end if(isRing == true) then local exp_ps2 = unit:addSimpleEffect(ENET_EFFECT_SP_ENVIRONMENT_EXPLOSION_RING) exp_ps2:suspendedDestroy(0.8) end local pos = D3DXVECTOR3:new(0,0,0) local l = 0 for l = 0,0 do local stroke_ps2 = {} local exp_ps = unit:addSimpleEffect(explodeType) local j = 0 --if(j == 10) then unit:explode(partsDist) end unit:explode(partsDist) for j = 0,NumOfRays do pos.x = rand(-20,20) pos.y = rand(15,40) pos.z = rand(-20,20) stroke_ps2[j] = unit:addSimpleEffect(RayEffect) stroke_ps2[j]:setLocalPosition(pos.x,pos.y,pos.z) local gravity = createInterpolator() gravity:addKey(0.0,-40.0) gravity:addKey(8.0,-400.0) gravity:finalize(false) local trajectory = stroke_ps2[j]:parabolicFly(pos,rand(40,70)) trajectory:addInterpolator(gravity,getFieldOffset(EN_FIELD_3DPARABOLICMOVER_GRAVITY)) --waitDeath(trajectory) end pause(0.7) local exp_ps_light = unit:addSimpleEffect(lightType) exp_ps:suspendedDestroy(10.0) exp_ps:setTransformOwner() exp_ps_light:suspendedDestroy(3.0) pause(0.3) for j = 0,NumOfRays do stroke_ps2[j]:suspendedDestroy(8.0) end end pause(0.6) local ht = getHeightType(unit:getWorldPosition()); --if(isShakeCamera == true and ht ~= ENBHT_WATERHIT) then getCamera():shake(1.0,6.0) end -- explosion mark pause(0.25) if(ht ~= ENBHT_WATERHIT) then local exp_mark = unit:addSimpleEffect(ENET_EFFECT_DYNAMICGEOMETRY_EXPLOSIONMARK_BIG) exp_mark:delayedDestroy(70.0) exp_mark:setTransformOwner() -- local upos = unit:getWorldPosition() -- getCamera():setLocalPosition(upos.x,upos.y,upos.z - 200) end local wv = unit:findEffect(ENET_EFFECTSEMITTER_SHIPSTANDINGWATERWAVE) if(wv ~= nil) then wv:suspendedDestroy(4) end unit:removeSpaceHoldingEffects(); units_stopFansRadars() pos:delete() end function units_explode_basef(partsDist,explodeType,isShakeCamera,isRing,lightType) local unit = uniGetExecutor() -- unit:setLifeParams(1,0) unit:setTransformOwner() unit:play3DSound("bigunitexplode.wav",0):destroy() -- stop burning effects local fire fire = unit:findEffect(ENET_EFFECT_PS_SMALLUNITFIRING) if(fire ~= nil) then fire:suspendedDestroy(1.0) end fire = unit:findEffect(ENET_EFFECT_PS_UNITFIRINGBADLY) if(fire ~= nil) then fire:suspendedDestroy(1.0) end if(isRing == true) then local exp_ps2 = unit:addSimpleEffect(ENET_EFFECT_SP_ENVIRONMENT_EXPLOSION_RING2) exp_ps2:suspendedDestroy(3.0) end pause(0.1) local base_exp = unit:addSimpleEffect(ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_BASEMENT) base_exp:suspendedDestroy(8.0) local pos = D3DXVECTOR3:new(0,0,0) local exp_ps_light = unit:addSimpleEffect(lightType) local small_expl = {} local j = 0 for j = 0,5 do pos.x = rand(-35,35) pos.y = rand(15,110) pos.z = rand(-30,35) small_expl[j] = unit:addParticleSystem(ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_BASE2,pos.x,pos.y,pos.z) pause(rand(0.1,0.4)) if(j == 3) then local exp_ps = unit:addSimpleEffect(explodeType) unit:explode(partsDist) exp_ps:suspendedDestroy(10.0) exp_ps:setTransformOwner() end end local base_exp55 = unit:addSimpleEffect(ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_BASEMENT) base_exp55:suspendedDestroy(8.0) pause(0.5) for j = 0,5 do small_expl[j]:suspendedDestroy(6.0) end exp_ps_light:suspendedDestroy(3.0) local exp_smoke = unit:addSimpleEffect(ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_BASE_SMOKE) exp_smoke:suspendedDestroy(10.0) pause(0.6) local ht = getHeightType(unit:getWorldPosition()); --if(isShakeCamera == true and ht ~= ENBHT_WATERHIT) then getCamera():shake(1.0,6.0) end -- explosion mark pause(0.25) if(ht ~= ENBHT_WATERHIT) then local exp_mark = unit:addSimpleEffect(ENET_EFFECT_DYNAMICGEOMETRY_EXPLOSIONMARK_BIG) exp_mark:delayedDestroy(70.0) exp_mark:setTransformOwner() -- local upos = unit:getWorldPosition() -- getCamera():setLocalPosition(upos.x,upos.y,upos.z - 200) end local wv = unit:findEffect(ENET_EFFECTSEMITTER_SHIPSTANDINGWATERWAVE) if(wv ~= nil) then wv:suspendedDestroy(4) end unit:removeSpaceHoldingEffects(); units_stopFansRadars() pos:delete() end function units_explode_oilplatformf(partsDist,explodeType,isShakeCamera,isRing,lightType) local unit = uniGetExecutor() -- unit:setLifeParams(1,0) unit:setTransformOwner() unit:play3DSound("bigunitexplode.wav",0):destroy() -- stop burning effects local fire fire = unit:findEffect(ENET_EFFECT_PS_SMALLUNITFIRING) if(fire ~= nil) then fire:suspendedDestroy(1.0) end fire = unit:findEffect(ENET_EFFECT_PS_UNITFIRINGBADLY) if(fire ~= nil) then fire:suspendedDestroy(1.0) end if(isRing == true) then local exp_ps2 = unit:addSimpleEffect(ENET_EFFECT_SP_ENVIRONMENT_EXPLOSION_RING2) exp_ps2:suspendedDestroy(3.0) end pause(0.1) local base_exp = unit:addSimpleEffect(ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_OILPLATFORMBASEMENT) base_exp:suspendedDestroy(8.0) local pos = D3DXVECTOR3:new(0,0,0) local exp_ps_light = unit:addSimpleEffect(lightType) local small_expl = {} local j = 0 for j = 0,9 do pos.x = rand(-1,1) pos.y = rand(-100,0) pos.z = rand(-1,1) small_expl[j] = unit:getBone(ENBT_FAN,0):addParticleSystem(ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_OILPLATFORM2,pos.x,pos.y,pos.z) pause(rand(0.01,0.05)) if(j == 8) then local exp_ps = unit:addSimpleEffect(explodeType) unit:explode(partsDist) exp_ps:suspendedDestroy(10.0) exp_ps:setTransformOwner() end end local base_exp55 = unit:addSimpleEffect(ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_OILPLATFORMBASEMENT) base_exp55:suspendedDestroy(8.0) pause(0.5) for j = 0,5 do small_expl[j]:suspendedDestroy(6.0) end exp_ps_light:suspendedDestroy(3.0) local exp_smoke = unit:addSimpleEffect(ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_OILPLATFORM_SMOKE) exp_smoke:suspendedDestroy(10.0) pause(0.6) local ht = getHeightType(unit:getWorldPosition()); --if(isShakeCamera == true and ht ~= ENBHT_WATERHIT) then getCamera():shake(1.0,6.0) end -- explosion mark pause(0.25) if(ht ~= ENBHT_WATERHIT) then local exp_mark = unit:addSimpleEffect(ENET_EFFECT_DYNAMICGEOMETRY_EXPLOSIONMARK_BIG) exp_mark:delayedDestroy(70.0) exp_mark:setTransformOwner() -- local upos = unit:getWorldPosition() -- getCamera():setLocalPosition(upos.x,upos.y,upos.z - 200) end local wv = unit:findEffect(ENET_EFFECTSEMITTER_SHIPSTANDINGWATERWAVE) if(wv ~= nil) then wv:suspendedDestroy(4) end unit:removeSpaceHoldingEffects(); units_stopFansRadars() pos:delete() end function units_explode_detailed4(partsDist,explodeType,isShakeCamera,isRing,lightType,numofRays) local unit = uniGetExecutor() -- unit:setLifeParams(1,0) unit:setTransformOwner() unit:play3DSound("bigunitexplode.wav",0):destroy() -- stop burning effects local fire fire = unit:findEffect(ENET_EFFECT_PS_SMALLUNITFIRING) if(fire ~= nil) then fire:suspendedDestroy(1.0) end fire = unit:findEffect(ENET_EFFECT_PS_UNITFIRINGBADLY) if(fire ~= nil) then fire:suspendedDestroy(1.0) end if(isRing == true) then local exp_ps2 = unit:addSimpleEffect(ENET_EFFECT_SP_ENVIRONMENT_EXPLOSION_RING) exp_ps2:suspendedDestroy(0.8) end local pos = D3DXVECTOR3:new(0,0,0) local l = 0 for l = 0,0 do local stroke_ps2 = {} local exp_ps = unit:getBone(ENBT_TARGET):addSimpleEffect(explodeType) exp_ps:setLocalPosition(0,-30,0) local j = 0 unit:explode(partsDist) for j = 0,numofRays do pos.x = rand(-10,10) pos.y = rand(-10,20) pos.z = rand(-10,10) stroke_ps2[j] = unit:getBone(ENBT_TARGET):addSimpleEffect(ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_BIG3_TRACE4) stroke_ps2[j]:setLocalPosition(pos.x,pos.y,pos.z) local gravity = createInterpolator() gravity:addKey(0.0,-10.0) gravity:addKey(13,-10.0) gravity:finalize(false) local trajectory = stroke_ps2[j]:parabolicFly(pos,rand(20,50)) trajectory:addInterpolator(gravity,getFieldOffset(EN_FIELD_3DPARABOLICMOVER_GRAVITY)) --waitDeath(trajectory) end pause(0.7) local exp_ps_light = unit:addSimpleEffect(lightType) exp_ps:suspendedDestroy(10.0) exp_ps:setTransformOwner() exp_ps_light:suspendedDestroy(3.0) pause(0.6) for j = 0,numofRays do stroke_ps2[j]:suspendedDestroy(8.0) end end pause(0.6) local ht = getHeightType(unit:getWorldPosition()); --if(isShakeCamera == true and ht ~= ENBHT_WATERHIT) then getCamera():shake(1.0,6.0) end -- explosion mark pause(0.25) if(ht ~= ENBHT_WATERHIT) then local exp_mark = unit:addSimpleEffect(ENET_EFFECT_DYNAMICGEOMETRY_EXPLOSIONMARK_BIG) exp_mark:delayedDestroy(70.0) exp_mark:setTransformOwner() -- local upos = unit:getWorldPosition() -- getCamera():setLocalPosition(upos.x,upos.y,upos.z - 200) end local wv = unit:findEffect(ENET_EFFECTSEMITTER_SHIPSTANDINGWATERWAVE) if(wv ~= nil) then wv:suspendedDestroy(4) end unit:removeSpaceHoldingEffects(); units_stopFansRadars() pos:delete() end function units_explode_det_water(partsDist,explodeType,isShakeCamera,isRing,lightType) local unit = uniGetExecutor() -- unit:setLifeParams(1,0) unit:setTransformOwner() unit:play3DSound("bigunitexplode.wav",0):destroy() -- stop burning effects local fire fire = unit:findEffect(ENET_EFFECT_PS_SMALLUNITFIRING) if(fire ~= nil) then fire:suspendedDestroy(1.0) end fire = unit:findEffect(ENET_EFFECT_PS_UNITFIRINGBADLY) if(fire ~= nil) then fire:suspendedDestroy(1.0) end local exp_ps = unit:addSimpleEffect(explodeType) local exp_ps_light = unit:addSimpleEffect(lightType) if(isRing == true) then local exp_ps2 = unit:addSimpleEffect(ENET_EFFECT_SP_ENVIRONMENT_EXPLOSION_RING) exp_ps2:suspendedDestroy(0.8) end exp_ps:suspendedDestroy(8.0) exp_ps:setTransformOwner() exp_ps_light:suspendedDestroy(3.0) pause(0.1) unit:explode(partsDist) local ht = getHeightType(unit:getWorldPosition()); if(isShakeCamera == true and ht ~= ENBHT_WATERHIT) then getCamera():shake(1.0,6.0) end -- explosion mark pause(0.25) if(ht ~= ENBHT_WATERHIT) then local exp_mark = unit:addSimpleEffect(ENET_EFFECT_DYNAMICGEOMETRY_EXPLOSIONMARK_BIG) exp_mark:delayedDestroy(70.0) exp_mark:setTransformOwner() -- local upos = unit:getWorldPosition() -- getCamera():setLocalPosition(upos.x,upos.y,upos.z - 200) end local wv = unit:findEffect(ENET_EFFECTSEMITTER_SHIPSTANDINGWATERWAVE) if(wv ~= nil) then wv:suspendedDestroy(4) end unit:removeSpaceHoldingEffects(); units_stopFansRadars() end function units_explode_det_water2(partsDist,explodeType,isShakeCamera,isRing,lightType) local unit = uniGetExecutor() -- unit:setLifeParams(1,0) unit:setTransformOwner() unit:play3DSound("bigunitexplode.wav",0):destroy() -- stop burning effects local fire fire = unit:findEffect(ENET_EFFECT_PS_SMALLUNITFIRING) if(fire ~= nil) then fire:suspendedDestroy(1.0) end fire = unit:findEffect(ENET_EFFECT_PS_UNITFIRINGBADLY) if(fire ~= nil) then fire:suspendedDestroy(1.0) end if(isRing == true) then local exp_ps2 = unit:addSimpleEffect(ENET_EFFECT_SP_ENVIRONMENT_EXPLOSION_RING) exp_ps2:suspendedDestroy(0.8) end local pos = D3DXVECTOR3:new(0,0,0) local l = 0 for l = 0,0 do local stroke_ps2 = {} local exp_ps = unit:addSimpleEffect(explodeType) local j = 0 for j = 0,60 do local nw = 0 nw = rand(0,20) if(j == 10) then unit:explode(partsDist) end pos.x = rand(-30,30) pos.y = rand(5,40) pos.z = rand(-30,30) stroke_ps2[j] = unit:addSimpleEffect(ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_BIG3_TRACE3) stroke_ps2[j]:setLocalPosition(pos.x,pos.y,pos.z) local gravity = createInterpolator() gravity:addKey(0.0,120.0) gravity:addKey(1.2,-220.0) gravity:addKey(4.8,0.0) gravity:addKey(13.0,0.0) gravity:finalize(false) local trajectory = stroke_ps2[j]:parabolicFly(pos,rand(20,60)) trajectory:addInterpolator(gravity,getFieldOffset(EN_FIELD_3DPARABOLICMOVER_GRAVITY)) end pause(0.7) local exp_ps_light = unit:addSimpleEffect(lightType) exp_ps:suspendedDestroy(13.0) exp_ps:setTransformOwner() exp_ps_light:suspendedDestroy(3.0) pause(4.8) for j = 0,60 do stroke_ps2[j]:suspendedDestroy(5.0) end end local ht = getHeightType(unit:getWorldPosition()); if(isShakeCamera == true and ht ~= ENBHT_WATERHIT) then getCamera():shake(1.0,6.0) end -- explosion mark pause(0.25) if(ht ~= ENBHT_WATERHIT) then local exp_mark = unit:addSimpleEffect(ENET_EFFECT_DYNAMICGEOMETRY_EXPLOSIONMARK_BIG) exp_mark:delayedDestroy(70.0) exp_mark:setTransformOwner() -- local upos = unit:getWorldPosition() -- getCamera():setLocalPosition(upos.x,upos.y,upos.z - 200) end local wv = unit:findEffect(ENET_EFFECTSEMITTER_SHIPSTANDINGWATERWAVE) if(wv ~= nil) then wv:suspendedDestroy(4) end unit:removeSpaceHoldingEffects(); units_stopFansRadars() pos:delete() end function units_explode_det_water3(partsDist,explodeType,isShakeCamera,isRing,lightType) local unit = uniGetExecutor() -- unit:setLifeParams(1,0) unit:setTransformOwner() unit:play3DSound("bigunitexplode.wav",0):destroy() -- stop burning effects local fire fire = unit:findEffect(ENET_EFFECT_PS_SMALLUNITFIRING) if(fire ~= nil) then fire:suspendedDestroy(1.0) end fire = unit:findEffect(ENET_EFFECT_PS_UNITFIRINGBADLY) if(fire ~= nil) then fire:suspendedDestroy(1.0) end if(isRing == true) then local exp_ps2 = unit:addSimpleEffect(ENET_EFFECT_SP_ENVIRONMENT_EXPLOSION_RING) exp_ps2:suspendedDestroy(0.8) end local pos = D3DXVECTOR3:new(0,0,0) local l = 0 for l = 0,0 do local stroke_ps2 = {} local exp_ps = unit:addSimpleEffect(explodeType) local j = 0 for j = 0,30 do local nw = 0 nw = rand(0,20) if(j == 10) then unit:explode(partsDist) end pos.x = rand(-30,30) pos.y = rand(2,20) pos.z = rand(-30,30) stroke_ps2[j] = unit:addSimpleEffect(ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_BIG3_TRACE3) stroke_ps2[j]:setLocalPosition(pos.x,pos.y,pos.z) local gravity = createInterpolator() gravity:addKey(0.0,-80.0) gravity:addKey(1.2,-80.0) gravity:addKey(4.8,0.0) gravity:addKey(13.0,0.0) gravity:finalize(false) local trajectory = stroke_ps2[j]:parabolicFly(pos,rand(20,80)) trajectory:addInterpolator(gravity,getFieldOffset(EN_FIELD_3DPARABOLICMOVER_GRAVITY)) end pause(0.7) local exp_ps_light = unit:addSimpleEffect(lightType) exp_ps:suspendedDestroy(13.0) exp_ps:setTransformOwner() exp_ps_light:suspendedDestroy(3.0) pause(4.8) for j = 0,30 do stroke_ps2[j]:suspendedDestroy(5.0) end end local ht = getHeightType(unit:getWorldPosition()); if(isShakeCamera == true and ht ~= ENBHT_WATERHIT) then getCamera():shake(1.0,6.0) end -- explosion mark pause(0.25) if(ht ~= ENBHT_WATERHIT) then local exp_mark = unit:addSimpleEffect(ENET_EFFECT_DYNAMICGEOMETRY_EXPLOSIONMARK_BIG) exp_mark:delayedDestroy(70.0) exp_mark:setTransformOwner() -- local upos = unit:getWorldPosition() -- getCamera():setLocalPosition(upos.x,upos.y,upos.z - 200) end local wv = unit:findEffect(ENET_EFFECTSEMITTER_SHIPSTANDINGWATERWAVE) if(wv ~= nil) then wv:suspendedDestroy(4) end unit:removeSpaceHoldingEffects(); units_stopFansRadars() pos:delete() end function units_explode_xxl1() units_explode_detailed2(200.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_BIG3,true,true,ENET_EFFECT_EXPLOSION_LIGHT2) end function units_explode_big() units_explode(200.0,ENET_EFFECT_PS_BIGUNITEXPLODE,true) end function units_explode_small() units_explode(50.0,ENET_EFFECT_PS_SMALLUNITEXPLODE,false) end function units_explode_small1() local rr = rand(0,4) if (rr < 1) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION1,false,true,ENET_EFFECT_EXPLOSION_LIGHT1) end if (rr >= 1 and rr < 2) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION2,false,true,ENET_EFFECT_EXPLOSION_LIGHT1) end if (rr >= 2 and rr < 3) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION1_GREEN,false,true,ENET_EFFECT_EXPLOSION_LIGHT1_GREEN) end if (rr >= 3 and rr <= 4) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION2_GREEN,false,true,ENET_EFFECT_EXPLOSION_LIGHT1_GREEN) end end function units_explode_small2() local rr = rand(0,4) if (rr < 1) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION1,false,true,ENET_EFFECT_EXPLOSION_LIGHT1) end if (rr >= 1 and rr < 2) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION2,false,true,ENET_EFFECT_EXPLOSION_LIGHT1) end if (rr >= 2 and rr < 3) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION1_GREEN,false,true,ENET_EFFECT_EXPLOSION_LIGHT1_GREEN) end if (rr >= 3 and rr <= 4) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION2_GREEN,false,true,ENET_EFFECT_EXPLOSION_LIGHT1_GREEN) end end function units_explode_small3() local rr = rand(0,6) if (rr < 1) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION3,false,true,ENET_EFFECT_EXPLOSION_LIGHT1) end if (rr >= 1 and rr < 2) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION4,false,true,ENET_EFFECT_EXPLOSION_LIGHT1) end if (rr >= 2 and rr < 3) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION3_GREEN,false,true,ENET_EFFECT_EXPLOSION_LIGHT1_GREEN) end if (rr >= 3 and rr < 4) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION4_GREEN,false,true,ENET_EFFECT_EXPLOSION_LIGHT1_GREEN) end if (rr >= 4 and rr < 5) then units_explode_detailed(70.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION5,false,true,ENET_EFFECT_EXPLOSION_LIGHT1) end if (rr >= 5 and rr <= 6) then units_explode_detailed(70.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION6,false,true,ENET_EFFECT_EXPLOSION_LIGHT1_GREEN) end end function units_explode_small4() local rr = rand(0,6) if (rr < 1) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION3,false,true,ENET_EFFECT_EXPLOSION_LIGHT1) end if (rr >= 1 and rr < 2) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION4,false,true,ENET_EFFECT_EXPLOSION_LIGHT1) end if (rr >= 2 and rr < 3) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION3_GREEN,false,true,ENET_EFFECT_EXPLOSION_LIGHT1_GREEN) end if (rr >= 3 and rr < 4) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION4_GREEN,false,true,ENET_EFFECT_EXPLOSION_LIGHT1_GREEN) end if (rr >= 4 and rr < 5) then units_explode_detailed(70.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION5,false,true,ENET_EFFECT_EXPLOSION_LIGHT1) end if (rr >= 5 and rr <= 6) then units_explode_detailed(70.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION6,false,true,ENET_EFFECT_EXPLOSION_LIGHT1_GREEN) end end function units_explode_small1_green() local rr = rand(0,4) if (rr < 1) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION1,false,true,ENET_EFFECT_EXPLOSION_LIGHT1) end if (rr >= 1 and rr < 2) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION2,false,true,ENET_EFFECT_EXPLOSION_LIGHT1) end if (rr >= 2 and rr < 3) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION1_GREEN,false,true,ENET_EFFECT_EXPLOSION_LIGHT1_GREEN) end if (rr >= 3 and rr <= 4) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION2_GREEN,false,true,ENET_EFFECT_EXPLOSION_LIGHT1_GREEN) end end function units_explode_small2_green() local rr = rand(0,4) if (rr < 1) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION1,false,true,ENET_EFFECT_EXPLOSION_LIGHT1) end if (rr >= 1 and rr < 2) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION2,false,true,ENET_EFFECT_EXPLOSION_LIGHT1) end if (rr >= 2 and rr < 3) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION1_GREEN,false,true,ENET_EFFECT_EXPLOSION_LIGHT1_GREEN) end if (rr >= 3 and rr <= 4) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION2_GREEN,false,true,ENET_EFFECT_EXPLOSION_LIGHT1_GREEN) end end function units_explode_small3_green() local rr = rand(0,6) if (rr < 1) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION3,false,true,ENET_EFFECT_EXPLOSION_LIGHT1) end if (rr >= 1 and rr < 2) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION4,false,true,ENET_EFFECT_EXPLOSION_LIGHT1) end if (rr >= 2 and rr < 3) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION3_GREEN,false,true,ENET_EFFECT_EXPLOSION_LIGHT1_GREEN) end if (rr >= 3 and rr < 4) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION4_GREEN,false,true,ENET_EFFECT_EXPLOSION_LIGHT1_GREEN) end if (rr >= 4 and rr < 5) then units_explode_detailed(70.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION5,false,true,ENET_EFFECT_EXPLOSION_LIGHT1) end if (rr >= 5 and rr <= 6) then units_explode_detailed(70.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION6,false,true,ENET_EFFECT_EXPLOSION_LIGHT1_GREEN) end end function units_explode_small4_green() local rr = rand(0,6) if (rr < 1) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION3,false,true,ENET_EFFECT_EXPLOSION_LIGHT1) end if (rr >= 1 and rr < 2) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION4,false,true,ENET_EFFECT_EXPLOSION_LIGHT1) end if (rr >= 2 and rr < 3) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION3_GREEN,false,true,ENET_EFFECT_EXPLOSION_LIGHT1_GREEN) end if (rr >= 3 and rr < 4) then units_explode_detailed(50.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION4_GREEN,false,true,ENET_EFFECT_EXPLOSION_LIGHT1_GREEN) end if (rr >= 4 and rr < 5) then units_explode_detailed(70.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION5,false,true,ENET_EFFECT_EXPLOSION_LIGHT1) end if (rr >= 5 and rr <= 6) then units_explode_detailed(70.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION6,false,true,ENET_EFFECT_EXPLOSION_LIGHT1_GREEN) end end function units_explode_big1() --[[ if rand(0,2) > 1 then units_explode_detailed(150.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_BIG1,true,true,ENET_EFFECT_EXPLOSION_LIGHT1) else units_explode_detailed(150.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_BIG2,true,true,ENET_EFFECT_EXPLOSION_LIGHT2) end ]]-- units_explode_detailed(150.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_BIG2,true,true,ENET_EFFECT_EXPLOSION_LIGHT2) end function units_explode_fire() units_explode_detailed4(150.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_BIG1B,true,true,ENET_EFFECT_EXPLOSION_LIGHT3,5) end function units_explode_xxl2() units_explode_detailed3(200.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_BIG4,true,true,ENET_EFFECT_EXPLOSION_LIGHT3) end function units_explode_water1() units_explode_det_water2(200.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_WATER1,true,true,ENET_EFFECT_EXPLOSION_LIGHT1) end function units_explode_water2() units_explode_det_water3(150.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_WATER2,true,true,ENET_EFFECT_EXPLOSION_LIGHT1) end function units_explode_water3() units_explode_det_water(100.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_WATER3,true,true,ENET_EFFECT_EXPLOSION_LIGHT1) end function units_explode_water4() units_explode_det_water(100.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_WATER4,true,true,ENET_EFFECT_EXPLOSION_LIGHT1) end function units_explode_xxl3() units_explode_expert(200.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_BIG5,true,true,ENET_EFFECT_EXPLOSION_LIGHT3,15,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_BIG3_TRACE5) end function units_explode_base() units_explode_basef(10.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_BASE,true,true,ENET_EFFECT_EXPLOSION_LIGHT4) end function units_explode_oilplatform() units_explode_oilplatformf(10.0,ENET_EFFECT_PS_ENVIRONMENT_EXPLOSION_OILPLATFORM,true,true,ENET_EFFECT_EXPLOSION_LIGHT4) end function building_setup(shadowType) units_setup(4,false,nil,shadowType) local unit = uniGetExecutor() local nBones = unit:getBonesCount() local i local bone for i = 0,nBones-1 do bone = unit:getBone(ENBT_TOTAL,i) if bone:getScriptSet() ~= ENSCRIPTSET_TARGETBONE then bone:setScriptSet(ENSCRIPTSET_BASE_BONE) end end unit:addMaskRender(ENMAT_CAPITAL_MASK) end function units_setup(maxLifePoints,isRed,smokeType,shadowType,isNotRotateFans,isPlaySound) maxLifePoints = uniGetMaxLife() local unit = uniGetExecutor() isRed = false if(unit:getUID() < 4096) then isRed = true end if(isPlaySound == nil) then unit:play3DSound("setup.wav",0):destroy() end if(smokeType ~= nil and uniGetTarget() == nil) then local smoke = unit:addSimpleEffect(smokeType) smoke:setTransformOwner() smoke:suspendedDestroy(2.0) end if(shadowType ~= nul) then unit:addSimpleEffect(shadowType) end if(maxLifePoints < 1000) then if(isRed) then unit:addLifeIndicator(0,1,0,0) else unit:addLifeIndicator(0,0,1,0) end end unit:setLifeParams(maxLifePoints,uniGetLife()) unit:resetBones() unit:resetAnimations() unit:addSimpleEffect(ENET_EFFECT_BOUNDEDTEXT) while(unit:getScale() < 1.0) do unit:setScale(1,1,1) pause() end unit:setVisibility(true,true) local owner = uniGetTarget() if(owner) then unit:setTransformOwner(units_findfreefirespot(owner,1)) unit:setLocalPosition(0,0,0) unit:setLocalOrientation(0,1,0,0,0,1) if(owner:getIsPlacesVisible() == false) then unit:setVisibility(false,false) end end if(isNotRotateFans == nil) then units_rotateFansRadars() end if( IsCommanderUnit(unit:getUID()) ) then local bone = unit:getBone(ENBT_FLAG) if(bone ~= nil) then local f = 1 if(isRed) then f = bone:addSimpleEffect(ENET_EFFECT_GEOMETRY_ROCKETEXPLODE) else f = bone:addSimpleEffect(ENET_EFFECT_GEOMETRY_FATEST) end f:setLocalOrientation(0,1,0,0,0,-1) if( unit:getScriptSet() ~= ENSCRIPTSET_HELICOPTER and unit:getScriptSet() ~= ENSCRIPTSET_HELICOPTER_ALIEN) then f:setScale(3.0,3.0,3.0) else f:setScale(2.0,2.0,2.0) end end end end function units_setup_sea(max_hp,isRed,isSetup,shadowType) units_setup(max_hp,isRed,nil,shadowType) local unit = uniGetExecutor() unit:addSimpleEffect(ENET_EFFECT_ROTATE_SHIP) --unit:addSimpleEffect(ENET_EFFECTSEMITTER_SHIPSTANDINGWATERWAVE) unit:addSimpleEffect(ENET_EFFECTEMITTER_WATERTRAY) if(isSetup == true) then local wave; wave = unit:addSimpleEffect(ENET_EFFECT_BINDEDSPRITE_WATERSHOCKWAVE_SHIPSETUP) wave:delayedDestroy(2.0) wave:setTransformOwner() wave = unit:addSimpleEffect(ENET_EFFECT_BINDEDSPRITE_WATERSHOCKWAVE_SHIPSETUP1) wave:delayedDestroy(2.0) wave:setTransformOwner() wave = unit:addSimpleEffect(ENET_EFFECT_BINDEDSPRITE_WATERSHOCKWAVE_SHIPSETUP2) wave:delayedDestroy(2.0) wave:setTransformOwner() wave = unit:addSimpleEffect(ENET_EFFECT_BINDEDSPRITE_WATERSHOCKWAVE_SHIPSETUP3) wave:delayedDestroy(2.0) wave:setTransformOwner() end end function units_unselect() local unit = uniGetExecutor() -- unit:killEffect(ENET_EFFECT_ROTATE_RADAR) -- unit:killEffect(ENET_EFFECT_GEOMETRY_ALLYSELECT) unit:killEffect(ENET_EFFECT_UNIT_SELECTION) unit:killEffect(ENET_EFFECT_GEOMETRY_FIRERANGE) unit:killEffect(ENET_EFFECT_SELECTEDGEOMETRY_ENEMY) unit:killEffect(ENET_EFFECT_GEOMETRY_HIGHLIGHT) end function units_select(selectionRadius,fireRangeRadius) units_unselect() local unit = uniGetExecutor() if(selectionRadius > 0) then -- unit:addEffectWithRadius(ENET_EFFECT_GEOMETRY_ALLYSELECT,selectionRadius) -- unit:addEffectWithRadius(ENET_EFFECT_UNIT_SELECTION,selectionRadius):addRotationEffect(ENET_EFFECT_ROTATE_RADAR,-1 * MATH_PI / 4) local sel = unit:addSimpleEffect( ENET_EFFECT_UNIT_SELECTION ) addTextureRotation( sel, -math.pi / 4, 0.5, 0.5 ) end if(uniGetMaxLife() ~= 0) then unit:addEffectWithRadius(ENET_EFFECT_GEOMETRY_FIRERANGE,getHexRadius(uniGetMaxLife())) end end function units_executesimplecommand() uniGetExecutor():executeInternalCommand() end function units_inside() pause(100000) end function units_waitCommandByUID(unit,UID) while(true) do if(unit:getCurrentCommandUID() == UID) then break end pause() end end function units_minLoadSize(unit) local box_size = unit:getBBoxSize() local scale = 6.5 / box_size if(scale > 0.75) then scale = 0.75 end return scale end function units_unload_growth(unit) if(unit:getScale() < 0.8) then local load_effect = unit:addSimpleEffect(ENET_EFFECT_PS_STRANSPORT_LIGHTING) load_effect:delayedDestroy(2.7) load_effect:setTransformOwner() interpolator = createInterpolator() interpolator:addKey(0.0,units_minLoadSize(unit)) interpolator:addKey(0.2,1.0) interpolator:finalize(false) unit:addInterpolator(interpolator,getFieldOffset(EN_FIELD_SCALE_X),true) unit:addInterpolator(interpolator,getFieldOffset(EN_FIELD_SCALE_Y),true) unit:addInterpolator(interpolator,getFieldOffset(EN_FIELD_SCALE_Z),true) pause(0.2) load_effect:suspendedDestroy(2.5) end end function units_load_shrink(unit) if(unit:getScale() > 0.8) then local load_effect = unit:addSimpleEffect(ENET_EFFECT_PS_STRANSPORT_LIGHTING) load_effect:delayedDestroy(2.7) load_effect:setTransformOwner() interpolator = createInterpolator() interpolator:addKey(0.0,1.0) interpolator:addKey(0.2,units_minLoadSize(unit)) interpolator:finalize(false) unit:addInterpolator(interpolator,getFieldOffset(EN_FIELD_SCALE_X),true) unit:addInterpolator(interpolator,getFieldOffset(EN_FIELD_SCALE_Y),true) unit:addInterpolator(interpolator,getFieldOffset(EN_FIELD_SCALE_Z),true) pause(0.2) load_effect:suspendedDestroy(2.5) end end function units_addGround(unit,g_type) local ground = unit:addSimpleEffect(g_type) ground:setTransformOwner() ground:setVisibility(false,false) local groundHolder = enHolder:new(ground,HT_DESTROYER) return groundHolder end function units_rotateFansRadars() local unit = uniGetExecutor() local fan local i = 0 while true do fan = unit:getBone(ENBT_FAN,i) if(fan == nil) then break end local speed = rand(MATH_PI * 1.0,MATH_PI * 2.0) if(rand(0,10) < 5) then speed = -speed end fan:addRotationEffect(ENET_EFFECT_ROTATE_RADAR,speed) i = i + 1 end i = 0 while true do fan = unit:getBone(ENBT_RADAR,i) if(fan == nil) then break end local speed = rand(MATH_PI * 0.5,MATH_PI * 0.8) if(rand(0,10) < 5) then speed = -speed end fan:addRotationEffect(ENET_EFFECT_ROTATE_RADAR,speed) i = i + 1 end end function units_stopFansRadars() local unit = uniGetExecutor() local fan local i = 0 while true do fan = unit:getBone(ENBT_FAN,i) if(fan == nil) then break end local rotor = fan:findEffect(ENET_EFFECT_ROTATE_RADAR) if(rotor ~= nil) then rotor:destroy() end rotor = fan:findEffect(ENET_EFFECT_ROTATE_WHEEL) if(rotor ~= nil) then rotor:destroy() end i = i + 1 end i = 0 while true do fan = unit:getBone(ENBT_RADAR,i) if(fan == nil) then break end local rotor = fan:findEffect(ENET_EFFECT_ROTATE_RADAR) if(rotor ~= nil) then rotor:destroy() end i = i + 1 end end function units_rotateWheels() local unit = uniGetExecutor() local wheel local i = 0 while true do wheel = unit:getBone(ENBT_WHEEL,i) if(wheel == nil) then break end wheel:addRotationEffect(ENET_EFFECT_ROTATE_WHEEL,MATH_PI * 5) i = i + 1 end end function units_stopWheels() local unit = uniGetExecutor() local wheel local i = 0 while true do wheel = unit:getBone(ENBT_WHEEL,i) if(wheel == nil) then break end local rotor = wheel:findEffect(ENET_EFFECT_ROTATE_WHEEL) if(rotor ~= nil) then rotor:destroy() end i = i + 1 end end function wait_for_platform(unit) if (unit:getTransformOwner() ~= nil) then local carrier = unit:getTransformOwner():getTransformOwner() while(carrier:getCurrentCommandUID() < 2000000000) do pause() end else end end